

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>会员专享新菜</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">

  </head>
  <body>
    <div class="page-group">
        <div class="page page-current">
			<header class="bar bar-nav">
			  <h1 class='title'>会员免费享新菜</h1>
			</header>
			<div class="content">
				
				 <div class="content-block-title">2019年春季新菜</div>
				  
					<div class="card">
					<div class="card-content">
					  <img src="https://www.cshxian.com/attachment/images/3/2019/03/B1MPg8G561mZMGPMoS5PO605gmQgRG.jpg" width="100%" >
					</div> 
				 </div>
				  
				 <div class="content-block-title">会员信息：</div>
				 <div class="card">
					<div class="card-content">
					  <div class="card-content-inner" id="member-info"></div>
					</div> 
				 </div>
				 
				 
			
				<div class="list-block" id="free-dish">
				
					<div class="content-block">	
						<ul>
						  <!-- Text inputs -->
						  <li>
							<div class="item-content">
							  <div class="item-media"><i class="icon icon-form-name"></i></div>
							  <div class="item-inner">
								<div class="item-title label">菜名</div>
								<div class="item-input">
								  <input type="text" id="picker" placeholder="点击选择新菜" >
								</div>
							  </div>
							</div>
						  </li>
						  <li>
							<div class="item-content">
							  <div class="item-media"><i class="icon icon-form-email"></i></div>
							  <div class="item-inner">
								<div class="item-title label">房/桌号</div>
								<div class="item-input">
								  <input id="table" type="text" placeholder="点击选择">
								</div>
							  </div>
							</div>
						  </li>
						 </ul>
					</div> 
			  </div>
			  <div class="content-block">
				
				  <p><a href="#" class="button button-big" id ="subthing">立即下单 </a></p>
				
			  </div>
			</div>
        <!-- 你的html代码 -->
        </div>
    </div>

    <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>
	
	<script>
		//获取code
		
			//alert(data);
			console.log(data);
			//$("#member-info").text(data.name);
			//操作码为1代表可以赠送
			var user = new Array();
			var data = new Array();
			data['name'] = '<?php echo $name ?>';
			data['phone'] = '<?php echo $phone ?>';
			data['operation'] = '<?php echo $operation ?>';
			
			if(data.operation == 1 ){
				
				$("#member-register,#member-register-title").hide();
				$("#member-info").text('尊贵的船说会员  '+data['name']+'、会员手机号'+data['phone']+'。船说春季新菜推出了，厨师精心研发，就为给您带来舌尖上的非凡体验，为感谢您的支持，您可任选以上新菜，填好桌号后，提交就可免费赠送一份体验品尝，每桌限一份。');
				user.phone = data.phone;
			
			//操作码为2代表已经赠送过
			}else if(data.operation == 2){
				
				$("#member-info").text('尊贵的船说会员  '+data['name']+'、会员手机号'+data['phone']+'。您已经赠送过一次了，感谢您的支持，欢迎在下季新菜推出后参加吧，会有微信推送和短信通知的哦。');
				$("#free-dish").hide();
				$("#member-register,#member-register-title").hide();
				$(".button").hide();
				
			//0或其他操作码需要注册
			}else {
				
				
				
				
			
			
			}
			
			
			
		
		
		
		var memberinfo = $('#member-info').text();
			//console.log(memberinfo);
			if(memberinfo == ""){
				//window.location.href = "index1.php";
			}
		
		//点击下单
			$(document).on('click','#subthing', function () {
				user.dishName = $("#picker").val();
				user.table = $('#table').val();
				console.log(user);
				
				
					if(user.dishName == ""){
					
						$.alert("请选择菜名");
						
					}else if(user.table == ""){
						
					
						$.alert("请选择桌号");
					
						
					}else{
					
						$.post('api.php?operation=insertdish',{dish:user.dishName,phone:user.phone,desk:user.table}, function(response){
								if(response == 1){
									$.alert("下单成功,菜在25分钟内上桌");
									
								}
							})
					
					}
				
			});
		
		
		
		
		
		$("#picker").picker({
		  toolbarTemplate: '<header class="bar bar-nav">\
		  <button class="button button-link pull-left">返回</button>\
		  <button class="button button-link pull-right close-picker">确定</button>\
		  <h1 class="title">菜品</h1>\
		  </header>',
		  cols: [
			{
			  textAlign: 'center',
			  values: ['Q弹肥肠', '雪花牛肉粒', '荷塘月色', '沙姜冰爽猪手', '招牌水晶鸡', '清爽小甜豆', '雪菜烩竹衣', '香葱煎豆腐', '韭菜柴火香干', '野菜花炒鱼扣', '豉香安化砣粉', '酸藕尖炒脆肚']
			}
		  ]
		});
		
		$("#table").picker({
		  toolbarTemplate: '<header class="bar bar-nav">\
		  <button class="button button-link pull-right close-picker">确定</button>\
		  <h1 class="title">桌号</h1>\
		  </header>',
		  cols: [
			{
			  textAlign: 'center',
			  values: ['包房V', '包间B', '卡座K', '大厅T']
			  //如果你希望显示文案和实际值不同，可以在这里加一个displayValues: [.....]
			},
			{
			  textAlign: 'center',
			  values: ['01', '02', '05', '06', '07', '08', '09', '10', '11', '12']
			}
		  ]
		});
		
		
		
		
		
		
</script>

  </body>
</html>